<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jq/jquery.js"></script>
    <style>
        body {
            background: skyblue;
        }

        table {
            background: #fff;
            border: 1px solid #0094ff;
            margin: 50px auto;
            text-align: center;
            border-collapse: collapse;
        }

        table td {
            border: 1px solid #0094ff;
            padding: 5px;
        }
    </style>
</head>

<body>
    <table>
        <tr>
            <td colspan="2">欢迎登录~~~</td>
        </tr>
        <tr>
            <td>用户名：</td>
            <td><input type="text" id="txtUName" placeholder="讨厌..."></td>
        </tr>
        <tr>
            <td>密 码：</td>
            <td><input type="password" id="txtPwd" placeholder="快说你银行卡密码多少..."></td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" value="登录" class="loginBtn ">
                <input type="button" value="注册" class="registerBtN ">
            </td>
        </tr>
    </table>
    <script>
        $(function () {
            const data = {

            };
            $('.loginBtn').on('click', function () {
                // console.log(data);
                let uname = $('#txtUName').val();
                let pwd = $('#txtPwd').val();
                if (data.uname === undefined || data.pwd === undefined) {
                    $('#txtUName').val('');
                    $('#txtPwd').val('');
                    return alert('快去注册个账号吧');
                }
                if (uname == data.uname && pwd == data.pwd) alert('欢迎大哥光临');
                $('#txtUName').val('');
                $('#txtPwd').val('');
            })
            $('.registerBtN').on('click', function () {

                data.uname = $('#txtUName').val();
                data.pwd = $('#txtPwd').val()
                if ($('#txtUName').val() == "" || $('#txtPwd').val() == "") {
                    alert('快去注册个账号吧')
                    return
                } else {
                    alert('恭喜你成为本洗浴中心vvvvvvvvvip会员');
                };
                $('#txtUName').val('');
                $('#txtPwd').val('')
            })

        })

    </script>
</body>

</html>